import {useState} from 'react';
import FilterFooter from '../../../../components/FilterFooter'
import {PickerView} from 'antd-mobile'

const FilterPicker=(props)=>{
  const {onCancel,onSave,data,cols,type,defaultValue}=props
  const [value,setVal]=useState(defaultValue)
    const handleChange=(val)=>{
        setVal(val)
    }
    return(
        <>
            {/* 选择器组件 */}
            <PickerView data={data} value={value} cols={cols}
            onChange={handleChange}
            />
            {/* 底部按钮 */}
            <FilterFooter 
            onCancel={()=>onCancel(type)}
            onOk={()=>onSave(type,value)}
            />
        </>
    )
}

export default FilterPicker